﻿@using BootstrapBlazor.Shared.Samples;
@inject IStringLocalizer<SweetAlerts> Localizer
@inject SwalService SwalService

<Button Icon="fa-solid fa-font-awesome" Text="@Localizer["SweetAlertsPopups"]" Color="Color.Success" OnClick="@ShowButtons" />

@code {
    private async Task ShowButtons()
    {
        var op = new SwalOption
        {
            Category = SwalCategory.Success,
            Title = "Title",
            Content = "Content",
            ShowClose = false,
            ButtonTemplate = new RenderFragment(builder =>
            {
                builder.OpenComponent<DialogCloseButton>(0);
                builder.AddAttribute(1, nameof(Button.Text), "Close");
                builder.CloseComponent();
            })
        };
        await SwalService.Show(op);
    }
}
